'\" t
.\"     Title: IPSEC_PLUTO
.\"    Author: Paul Wouters
.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/>
.\"      Date: 12/28/2012
.\"    Manual: Executable programs
.\"    Source: libreswan
.\"  Language: English
.\"
.TH "IPSEC_PLUTO" "8" "12/28/2012" "libreswan" "Executable programs"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ipsec_pluto \- ipsec whack : IPsec IKE keying daemon and control interface
.SH "SYNOPSIS"
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIpluto\fR [\-\-help] [\-\-version] [\-\-nofork] [\-\-stderrlog] [\-\-logfile\ \fIfilename\fR] [\-\-use\-klips] [\-\-use\-mast] [\-\-use\-netkey] [\-\-use\-nostack] [\-\-uniqueids] [\-\-nat_traversal] [\-\-virtual_private\ \fInetwork_list\fR] [\-\-keep_alive\ \fIdelay_sec\fR] [\-\-force_keepalive] [\-\-force_busy] [\-\-disable_port_floating] [\-\-nocrsend] [\-\-strictcrlpolicy] [\-\-crlcheckinterval] [\-\-interface\ \fIinterfacename\fR] [\-\-listen\ \fIipaddr\fR] [\-\-ikeport\ \fIportnumber\fR] [\-\-ctlbase\ \fIpath\fR] [\-\-secretsfile\ \fIsecrets\-file\fR] [\-\-adns\ \fIpathname\fR] [\-\-nhelpers\ \fInumber\fR] [\-\-perpeerlog] [\-\-perpeerlogbase\ \fIdirname\fR] [\-\-ipsecdir\ \fIdirname\fR] [\-\-coredir\ \fIdirname\fR] [\-\-noretransmits]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR [\-\-help] [\-\-version]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR [\-\-debug\-none] [\-\-debug\-all] [\-\-debug\-raw] [\-\-debug\-crypt] [\-\-debug\-parsing] [\-\-debug\-emitting] [\-\-debug\-control] [\-\-debug\-lifecycle] [\-\-debug\-klips] [\-\-debug\-pfkey] [\-\-debug\-nat\-t] [\-\-debug\-dpd] [\-\-debug\-dns] [\-\-debug\-oppo] [\-\-debug\-oppoinfo] [\-\-debug\-whackwatch] [\-\-debug\-private]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-name\ \fIconnection\-name\fR [[\-\-ipv4] | [\-\-ipv6]] [[\-\-tunnelipv4] | [\-\-tunnelipv6]]
.br

.br
[\-\-id\ \fIidentity\fR] [\-\-host\ \fIip\-address\fR] [\-\-cert\ \fIpath\fR] [\-\-ca\ \fIdistinguished\ name\fR] [\-\-groups\ \fIaccess\ control\ groups\fR] [\-\-sendcert\ yes\ |\ forced\ |\ always\ |\ ifasked\ |\ no\ |\ never] [\-\-certtype\ \fInumber\fR] [\-\-ikeport\ \fIportnumber\fR] [\-\-nexthop\ \fIip\-address\fR] [[\-\-client\ \fIsubnet\fR] | [\-\-clientwithin\ \fIsubnet\fR]] [\-\-clientprotoport\ \fIprotocol\fR/\fIport\fR] [\-\-srcip\ \fIip\-address\fR] [\-\-xauthserver] [\-\-xauthclient] [\-\-modecfgserver] [\-\-modecfgclient] [\-\-modecfgdns1] [\-\-modecfgdns2] [\-\-modecfgwins1] [\-\-modecfgwins2] [\-\-dnskeyondemand] [\-\-updown\ \fIupdown\fR]
.br

.br
\-\-to
.br

.br
[\-\-id\ \fIidentity\fR] [\-\-host\ \fIip\-address\fR] [\-\-cert\ \fIpath\fR] [\-\-ca\ \fIdistinguished\ name\fR] [\-\-groups\ \fIaccess\ control\ groups\fR] [\-\-sendcert\ yes\ |\ always\ |\ ifasked\ |\ no\ |\ never] [\-\-certtype\ \fInumber\fR] [\-\-ikeport\ \fIport\-number\fR] [\-\-nexthop\ \fIip\-address\fR] [\-\-client\ \fIsubnet\fR] [\-\-clientwithin\ \fIsubnet\fR] [\-\-clientprotoport\ \fIprotocol\fR/\fIport\fR] [\-\-srcip\ \fIip\-address\fR] [\-\-xauthserver] [\-\-xauthclient] [\-\-modecfgserver] [\-\-modecfgclient] [\-\-modecfgdns1\ \fIip\-address\fR] [\-\-modecfgdns2\ \fIip\-address\fR] [\-\-modecfgwins1\ \fIip\-address\fR] [\-\-modecfgwins2\ \fIip\-address\fR] [\-\-dnskeyondemand] [\-\-updown\ \fIupdown\fR]
.br

.br
[\-\-tunnel] [\-\-psk] [\-\-rsasig] [\-\-encrypt] [\-\-authenticate] [\-\-compress] [\-\-pfs] [\-\-pfsgroup\ [modp1024]\ |\ [modp1536]\ |\ [modp2048]\ |\ [modp3072]\ |\ [modp4096]\ |\ [modp6144]\ |\ [modp8192]] [\-\-disablearrivalcheck] [\-\-ikelifetime\ \fIseconds\fR] [\-\-ipseclifetime\ \fIseconds\fR] [\-\-rekeymargin\ \fIseconds\fR] [\-\-rekeyfuzz\ \fIpercentage\fR] [\-\-keyingtries\ \fIcount\fR] [\-\-esp\ \fIesp\-algos\fR] [\-\-dontrekey] [\-\-aggrmode] [\-\-modecfgpull] [[\-\-dpddelay\ \fIseconds\fR] | [\-\-dpdtimeout\ \fIseconds\fR]] [\-\-dpdaction\ [clear]\ |\ [hold]\ |\ [restart]] [\-\-forceencaps] [[\-\-initiateontraffic]\ |\ [\-\-pass]\ |\ [\-\-drop]\ |\ [\-\-reject]] [[\-\-failnone]\ |\ [\-\-failpass]\ |\ [\-\-faildrop]\ |\ [\-\-failreject]] [\-\-ctlbase\ \fIpath\fR] [\-\-label\ \fIstring\fR]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-keyid\ \fIid\fR [\-\-addkey] [\-\-pubkeyrsa\ \fIkey\fR] [\-\-ctlbase\ \fIpath\fR] [\-\-label\ \fIstring\fR]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-myid\ \fIid\fR
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-listen | \-\-unlisten  [\-\-ctlbase\ \fIpath\fR] [\-\-label\ \fIstring\fR]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-route | \-\-unroute  \-\-name\ \fIconnection\-name\fR [\-\-ctlbase\ \fIpath\fR] [\-\-label\ \fIstring\fR]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-initiate | \-\-terminate  \-\-name\ \fIconnection\-name\fR [\-\-xauthuser\ \fIuser\fR] [\-\-xauthpass\ \fIpass\fR] [\-\-asynchronous] [\-\-ctlbase\ \fIpath\fR] [\-\-label\ \fIstring\fR]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR [[\-\-tunnelipv4] | [\-\-tunnelipv6]] \-\-oppohere\ \fIip\-address\fR \-\-oppothere\ \fIip\-address\fR
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-crash [ipaddress]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-whackrecord [filename]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-whackstoprecord
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-name\ \fIconnection\-name\fR \-\-delete [\-\-ctlbase\ \fIpath\fR] [\-\-label\ \fIstring\fR]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-deletestate\ \fIstate\-number\fR [\-\-ctlbase\ \fIpath\fR] [\-\-label\ \fIstring\fR]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR [\-\-name\ \fIconnection\-name\fR] [\-\-debug\-none] [\-\-debug\-all] [\-\-debug\-raw] [\-\-debug\-crypt] [\-\-debug\-parsing] [\-\-debug\-emitting] [\-\-debug\-control] [\-\-debug\-controlmore] [\-\-debug\-lifecycle] [\-\-debug\-klips] [\-\-debug\-pfkey] [\-\-debug\-dns] [\-\-debug\-dpd] [\-\-debug\-natt] [\-\-debug\-oppo] [\-\-debug\-oppoinfo] [\-\-debug\-whackwatch] [\-\-debug\-private] [\-\-impair\-delay\-adns\-key\-answer] [\-\-impair\-delay\-adns\-txt\-answer] [\-\-impair\-bust\-mi2] [\-\-impair\-bust\-mr2] [\-\-impair\-sa\-fail] [\-\-impair\-die\-oninfo] [\-\-impair\-jacob\-two\-two]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR [\-\-utc] [\-\-listall] [\-\-listpubkeys] [\-\-listcerts] [\-\-listcacerts] [\-\-listacerts] [\-\-listaacerts] [\-\-listgroups] [\-\-listcrls]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR [\-\-utc] [\-\-rereadsecrets] [\-\-rereadall] [\-\-rereadcacerts] [\-\-rereadacerts] [\-\-rereadaacerts] [\-\-rereadcrls]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-listevents
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-status [\-\-ctlbase\ \fIpath\fR] [\-\-label\ \fIstring\fR]
.HP \w'\fBipsec\fR\ 'u
\fBipsec\fR \fIwhack\fR \-\-shutdown [\-\-ctlbase\ \fIpath\fR] [\-\-label\ \fIstring\fR]
.SH "DESCRIPTION"
.PP
\fBpluto\fR
is an IKE (\(lqIPsec Key Exchange\(rq) daemon\&.
\fBwhack\fR
is an auxiliary program to allow requests to be made to a running
\fBpluto\fR\&.
.PP
\fBpluto\fR
is used to automatically build shared \(lqsecurity associations\(rq on a system that has IPsec, the secure IP protocol\&. In other words,
\fBpluto\fR
can eliminate much of the work of manual keying\&. The actual secure transmission of packets is the responsibility of other parts of the system \- the kernel\&. Pluto can talk to various kernel implementations, such as
\fBKLIPS\fR, such as
\fBNETKEY\fR, and such as
\fBKAME\fR
IPsec stacks\&.
\fBipsec_auto\fR(8)
provides a more convenient interface to
\fBpluto\fR
and
\fBwhack\fR\&.
.SS "IKE\*(Aqs Job"
.PP
A
\fISecurity Association\fR
(\fISA\fR) is an agreement between two network nodes on how to process certain traffic between them\&. This processing involves encapsulation, authentication, encryption, or compression\&.
.PP
IKE can be deployed on a network node to negotiate Security Associations for that node\&. These IKE implementations can only negotiate with other IKE implementations, so IKE must be on each node that is to be an endpoint of an IKE\-negotiated Security Association\&. No other nodes need to be running IKE\&.
.PP
An IKE instance (i\&.e\&. an IKE implementation on a particular network node) communicates with another IKE instance using UDP IP packets, so there must be a route between the nodes in each direction\&.
.PP
The negotiation of Security Associations requires a number of choices that involve tradeoffs between security, convenience, trust, and efficiency\&. These are policy issues and are normally specified to the IKE instance by the system administrator\&.
.PP
IKE deals with two kinds of Security Associations\&. The first part of a negotiation between IKE instances is to build an ISAKMP SA\&. An ISAKMP SA is used to protect communication between the two IKEs\&. IPsec SAs can then be built by the IKEs \- these are used to carry protected IP traffic between the systems\&.
.PP
The negotiation of the ISAKMP SA is known as Phase 1\&. In theory, Phase 1 can be accomplished by a couple of different exchange types\&. Currently, Main Mode and Aggressive Mode are implemented\&.
.PP
Any negotiation under the protection of an ISAKMP SA, including the negotiation of IPsec SAs, is part of Phase 2\&. The exchange type that we use to negotiate an IPsec SA is called Quick Mode\&.
.PP
IKE instances must be able to authenticate each other as part of their negotiation of an ISAKMP SA\&. This can be done by several mechanisms described in the draft standards\&.
.PP
IKE negotiation can be initiated by any instance with any other\&. If both can find an agreeable set of characteristics for a Security Association, and both recognize each others authenticity, they can set up a Security Association\&. The standards do not specify what causes an IKE instance to initiate a negotiation\&.
.PP
In summary, an IKE instance is prepared to automate the management of Security Associations in an IPsec environment, but a number of issues are considered policy and are left in the system administrator\*(Aqs hands\&.
.SS "Pluto"
.PP
\fBpluto\fR
is an implementation of IKE\&. It runs as a daemon on a network node\&. Currently, this network node must be a LINUX system running the
\fBKLIPS\fR
or
\fBNETKEY\fR
implementation of IPsec, or a FreeBSD/NetBSD/Mac OSX system running the
\fBKAME\fR
implementation of IPsec\&.
.PP
\fBpluto\fR
implements a large subset of IKE\&. This is enough for it to interoperate with other instances of
\fBpluto\fR, and many other IKE implementations\&. It currently supports XAUTH, ModeConfig, X\&.509, Dead Peer Detection, Opportunistic Encryption and all the NAT Traversal standards\&.
.PP
The policy for acceptable characteristics for Security Associations is mostly hardwired into the code of
\fBpluto\fR
(spdb\&.c)\&. Eventually this will be moved into a security policy database with reasonable expressive power and more convenience\&.
.PP
\fBpluto\fR
uses shared secrets or RSA signatures to authenticate peers with whom it is negotiating\&. These RSA signatures can come from DNS(SEC), a configuration file, or from X\&.509 and CA certificates\&.
.PP
\fBpluto\fR
initiates negotiation of a Security Association when it is manually prodded: the program
\fBwhack\fR
is run to trigger this\&. It will also initiate a negotiation when
\fBKLIPS\fR
traps an outbound packet for Opportunistic Encryption\&.
.PP
\fBpluto\fR
implements ISAKMP SAs itself\&. After it has negotiated the characteristics of an IPsec SA, it directs the
\fBkernel\fR
to implement it\&. If necessary, it also invokes a script to adjust any firewall and issue
\fBroute\fR(8)
commands to direct IP packets\&.
.PP
When
\fBpluto\fR
shuts down, it closes all Security Associations\&.
.SS "Before Running Pluto"
.PP
\fBpluto\fR
runs as a daemon with userid root\&. Before running it, a few things must be set up\&.
.PP
\fBpluto\fR
requires a working IPsec stack\&.
.PP
\fBpluto\fR
supports multiple public networks (that is, networks that are considered insecure and thus need to have their traffic encrypted or authenticated)\&. It discovers the public interfaces to use by looking at all interfaces that are configured (the
\fB\-\-interface\fR
option can be used to limit the interfaces considered)\&. It does this only when
\fBwhack\fR
tells it to \-\-listen, so the interfaces must be configured by then\&. Each interface with a name of the form
\fBipsec\fR[0\-9] is taken as a
\fBKLIPS\fR
virtual public interface\&. Another network interface with the same IP address (the first one found will be used) is taken as the corresponding real public interface\&. The
\fB\-\-listen\fR
can be used to limit listening on only 1 IP address of a certain interface\&.
\fBifconfig\fR(8)
or
\fBip\fR(8)
with the
\fB\-a\fR
flag will show the name and status of each network interface\&.
.PP
\fBpluto\fR
requires a database of preshared secrets and RSA private keys\&. This is described in the
\fBipsec.secrets\fR(5)\&.
\fBpluto\fR
is told of RSA public keys via
\fBwhack\fR
commands\&. If the connection is Opportunistic, and no RSA public key is known,
\fBpluto\fR
will attempt to fetch RSA keys using the Domain Name System\&.
.SS "Setting up KLIPS for pluto"
.PP
The most basic network topology that
\fBpluto\fR
supports has two security gateways negotiating on behalf of client subnets\&. The diagram of RGB\*(Aqs testbed is a good example (see
\fIklips/doc/rgb_setup\&.txt\fR)\&.
.PP
The file
INSTALL
in the base directory of this distribution explains how to start setting up the whole system, including
\fBKLIPS\fR\&.
.PP
Make sure that the security gateways have routes to each other\&. This is usually covered by the default route, but may require issuing
\fBroute\fR(8)
commands\&. The route must go through a particular IP interface (we will assume it is
\fIeth0\fR, but it need not be)\&. The interface that connects the security gateway to its client must be a different one\&.
.PP
It is necessary to issue a
\fBipsec_tncfg\fR(8)
command on each gateway\&. The required command is:
.PP
\ \&\ \&\ \&ipsec tncfg \-\-attach\ \&\-\-virtual\ \&ipsec0 \-\-physical\ \&eth0
.PP
A command to set up the ipsec0 virtual interface will also need to be run\&. It will have the same parameters as the command used to set up the physical interface to which it has just been connected using
\fBipsec_tncfg\fR(8)\&.
.SS "Setting up NETKEY for pluto"
.PP
No special requirements are necessary to use NETKEY \- it ships with all modern versions of Linux 2\&.4 and 2\&.6\&. however, note that certain vendors or older distributions use old versions or backports of NETKEY which are broken\&. If possible use a NETKEY version that is at least based on, or backported from Linux 2\&.6\&.11 or newer\&.
.SS "ipsec\&.secrets file"
.PP
A
\fBpluto\fR
daemon and another IKE daemon (for example, another instance of
\fBpluto\fR) must convince each other that they are who they are supposed to be before any negotiation can succeed\&. This authentication is accomplished by using either secrets that have been shared beforehand (manually) or by using RSA signatures\&. There are other techniques, but they have not been implemented in
\fBpluto\fR\&.
.PP
The file
/etc/ipsec\&.secrets
is used to keep preshared secret keys, RSA private keys, X\&.509 encoded keyfiles and XAUTH passwords\&. Smartcards are handled via NSS\&. For debugging, there is an argument to the
\fBpluto\fR
command to use a different file\&. This file is described in
\fBipsec.secrets\fR(5)\&.
.SS "Running Pluto"
.PP
To fire up the daemon, just type
\fBpluto\fR
(be sure to be running as the superuser)\&. The default IKE port number is 500, the UDP port assigned by IANA for IKE Daemons\&.
\fBpluto\fR
must be run by the superuser to be able to use the UDP 500 port\&. If pluto is told to enable NAT\-Traversal, then UDP port 4500 is also taken by pluto to listen on\&.
.PP
Pluto supports different IPstacks on different operating systems\&. This can be configured using one of the options
\fB\-\-use\-netkey\fR
(the default),
\fB\-\-use\-klips\fR,
\fB\-\-use\-mast\fR,
\fB\-\-use\-bsdkame\fR,
\fB\-\-use\-win2k\fR
or
\fB\-\-use\-nostack\fR\&. The latter is meant for testing only \- no actual IPsec connections will be loaded into the kernel\&. The option
\fB\-\-use\-auto\fR
has been obsoleted\&. On startup, pluto might also read the
\fBprotostack=\fR
option to select the IPsec stack to use if
\fB\-\-config /etc/ipsec\&.conf\fR
is given as argument to pluto\&. If both
\fB\-\-use\-XXX\fR
and
\fB\-\-config /etc/ipsec\&.conf\fR
are specified, the last command line argument specified takes precedence\&.
.PP
Pluto supports the NAT\-Traversal drafts and the final standard, RFC 3947, if the
\fB\-\-nat_traversal\fR
is specified\&. The allowed range behind the NAT routers is submitted using the
\fB\-\-virtual_private\fR
option\&. See
\fBipsec.conf\fR(5)
for the syntax\&. The option
\fB\-\-force_keepalive\fR
forces the sending of the
\fIkeep\-alive packets\fR, which are send to prevent the NAT router from closing its port when there is not enough traffic on the IPsec connection\&. The
\fB\-\-keep_alive\fR
sets the delay (in seconds) of these keep\-alive packets\&. The newer NAT\-T standards support
\fIport floating\fR, and Libreswan enables this per default\&. It can be disabled using the
\fB\-\-disable_port_floating\fR
option\&.
.PP
Pluto supports the use of X\&.509 certificates and sends it certificate when needed\&. This can confuse IKE implementations that do not implement this, such as the old FreeS/WAN implementation\&. The
\fB\-\-nocrsend\fR
prevents pluto from sending these\&. At startup, pluto loads all the X\&.509 related files from the directories
/etc/ipsec\&.d/certs,
/etc/ipsec\&.d/cacerts,
/etc/ipsec\&.d/aacerts,
/etc/ipsec\&.d/private
and
/etc/ipsec\&.d/crls\&. The
\fICertificate Revocation Lists\fR
can also be retrieved from an URL\&. The option
\fB\-\-crlcheckinterval\fR
sets the time between checking for CRL expiration and issuing new fetch commands\&. The first attempt to update a CRL is started at
\fI2*crlcheckinterval\fR
before the next update time\&. Pluto logs a warning if no valid CRL was loaded or obtained for a connection\&. If
\fB\-\-strictcrlpolicy\fR
is given, the connection will be rejected until a valid CRL has been loaded\&.
.PP
Pluto can also use helper children to off\-load cryptographic operations\&. This behavior can be fine tuned using the
\fB\-\-nhelpers\fR\&. Pluto will start
\fI(n\-1)\fR
of them, where
\fIn\fR
is the number of CPU\(cqs you have (including hypherthreaded CPU\(cqs)\&. A value of
\fI0\fR
forces pluto to do all operations in the main process\&. A value of
\fI\-1\fR
tells pluto to perform the above calculation\&. Any other value forces the number to that amount\&.
.PP
\fBpluto\fR
attempts to create a lockfile with the name
/var/run/pluto/pluto\&.pid\&. If the lockfile cannot be created,
\fBpluto\fR
exits \- this prevents multiple
\fBpluto\fRs from competing Any \(lqleftover\(rq lockfile must be removed before
\fBpluto\fR
will run\&.
\fBpluto\fR
writes its pid into this file so that scripts can find it\&. This lock will not function properly if it is on an NFS volume (but sharing locks on multiple machines doesn\*(Aqt make sense anyway)\&.
.PP
\fBpluto\fR
then forks and the parent exits\&. This is the conventional \(lqdaemon fork\(rq\&. It can make debugging awkward, so there is an option to suppress this fork\&. In certain configurations, pluto might also launch helper programs to assist with DNS queries or to offload cryptographic operations\&.
.PP
All logging, including diagnostics, is sent to
\fBsyslog\fR(3)
with facility=authpriv; it decides where to put these messages (possibly in /var/log/secure or /var/log/auth\&.log)\&. Since this too can make debugging awkward, the option
\fB\-\-stderrlog\fR
is used to steer logging to stderr\&.
.PP
Alternatively,
\fB\-\-logfile\fR
can be used to send all logging information to a specific file\&.
.PP
If the
\fB\-\-perpeerlog\fR
option is given, then pluto will open a log file per connection\&. By default, this is in /var/log/pluto/peer, in a subdirectory formed by turning all dot (\&.) [IPv4} or colon (:) [IPv6] into slashes (/)\&.
.PP
The base directory can be changed with the
\fB\-\-perpeerlogbase\fR\&.
.PP
Once
\fBpluto\fR
is started, it waits for requests from
\fBwhack\fR\&.
.SS "Pluto\*(Aqs Internal State"
.PP
To understand how to use
\fBpluto\fR, it is helpful to understand a little about its internal state\&. Furthermore, the terminology is needed to decipher some of the diagnostic messages\&.
.PP
Pluto supports
\fBfood groups\fR, and X\&.509 certificates\&. These are located in /etc/ipsec\&.d, or another directory as specified by
\fB\-\-ipsecdir\fR\&.
.PP
Pluto may core dump\&. It will normally do so into the current working directory\&. The standard scripts have an option dumpdir=, which can set the current directory to determine where the core dump will go\&. In some cases, it may be more convenient to specify it on the command line using \-\-coredir\&. A third method is to set the environment variable PLUTO_CORE_DIR\&. The command line argument takes precedence over the environment variable\&. The option plutorestartoncrash can be set to no to prevent multiple core files and a looping pluto process\&. Normally, when pluto crashes, another pluto process is started\&.
.PP
At times it may be desireable to turn off all timed events in
\fBpluto\fR, this can be done with
\fB\-\-noretransmits\fR\&.
.PP
The
\fI(potential) connection\fR
database describes attributes of a connection\&. These include the IP addresses of the hosts and client subnets and the security characteristics desired\&.
\fBpluto\fR
requires this information (simply called a connection) before it can respond to a request to build an SA\&. Each connection is given a name when it is created, and all references are made using this name\&.
.PP
During the IKE exchange to build an SA, the information about the negotiation is represented in a
\fIstate object\fR\&. Each state object reflects how far the negotiation has reached\&. Once the negotiation is complete and the SA established, the state object remains to represent the SA\&. When the SA is terminated, the state object is discarded\&. Each State object is given a serial number and this is used to refer to the state objects in logged messages\&.
.PP
Each state object corresponds to a connection and can be thought of as an instantiation of that connection\&. At any particular time, there may be any number of state objects corresponding to a particular connection\&. Often there is one representing an ISAKMP SA and another representing an IPsec SA\&.
.PP
\fBKLIPS\fR
hooks into the routing code in a LINUX kernel\&. Traffic to be processed by an IPsec SA must be directed through
\fBKLIPS\fR
by routing commands\&. Furthermore, the processing to be done is specified by
\fIipsec eroute(8)\fR
commands\&.
\fBpluto\fR
takes the responsibility of managing both of these special kinds of routes\&.
.PP
\fBNETKEY\fR
requires no special routing\&.
.PP
Each connection may be routed, and must be while it has an IPsec SA\&. The connection specifies the characteristics of the route: the interface on this machine, the \(lqgateway\(rq (the nexthop), and the peer\*(Aqs client subnet\&. Two connections may not be simultaneously routed if they are for the same peer\*(Aqs client subnet but use different interfaces or gateways (\fBpluto\fR\*(Aqs logic does not reflect any advanced routing capabilities)\&.
.PP
On KLIPS, each eroute is associated with the state object for an IPsec SA because it has the particular characteristics of the SA\&. Two eroutes conflict if they specify the identical local and remote clients (unlike for routes, the local clients are taken into account)\&.
.PP
When
\fBpluto\fR
needs to install a route for a connection, it must make sure that no conflicting route is in use\&. If another connection has a conflicting route, that route will be taken down, as long as there is no IPsec SA instantiating that connection\&. If there is such an IPsec SA, the attempt to install a route will fail\&.
.PP
There is an exception\&. If
\fBpluto\fR, as Responder, needs to install a route to a fixed client subnet for a connection, and there is already a conflicting route, then the SAs using the route are deleted to make room for the new SAs\&. The rationale is that the new connection is probably more current\&. The need for this usually is a product of Road Warrior connections (these are explained later; they cannot be used to initiate)\&.
.PP
When
\fBpluto\fR
needs to install an eroute for an IPsec SA (for a state object), first the state object\*(Aqs connection must be routed (if this cannot be done, the eroute and SA will not be installed)\&. If a conflicting eroute is already in place for another connection, the eroute and SA will not be installed (but note that the routing exception mentioned above may have already deleted potentially conflicting SAs)\&. If another IPsec SA for the same connection already has an eroute, all its outgoing traffic is taken over by the new eroute\&. The incoming traffic will still be processed\&. This characteristic is exploited during rekeying\&.
.PP
All of these routing characteristics are expected change when
\fBKLIPS\fR
and
\fBNETKEY\fR
merge into a single new stack\&.
.SS "Using Whack"
.PP
\fBwhack\fR
is used to command a running
\fBpluto\fR\&.
\fBwhack\fR
uses a UNIX domain socket to speak to
\fBpluto\fR
(by default,
/var/pluto\&.ctl)\&.
.PP
\fBwhack\fR
has an intricate argument syntax\&. This syntax allows many different functions to be specified\&. The help form shows the usage or version information\&. The connection form gives
\fBpluto\fR
a description of a potential connection\&. The public key form informs
\fBpluto\fR
of the RSA public key for a potential peer\&. The delete form deletes a connection description and all SAs corresponding to it\&. The listen form tells
\fBpluto\fR
to start or stop listening on the public interfaces for IKE requests from peers\&. The route form tells
\fBpluto\fR
to set up routing for a connection; the unroute form undoes this\&. The initiate form tells
\fBpluto\fR
to negotiate an SA corresponding to a connection\&. The terminate form tells
\fBpluto\fR
to remove all SAs corresponding to a connection, including those being negotiated\&. The status form displays the
\fBpluto\fR\*(Aqs internal state\&. The debug form tells
\fBpluto\fR
to change the selection of debugging output \(lqon the fly\(rq\&. The shutdown form tells
\fBpluto\fR
to shut down, deleting all SAs\&.
.PP
The crash option asks pluto to consider a particularly target IP to have crashed, and to attempt to restart all connections with that IP address as a gateway\&. In general, you should use Dead Peer Detection to detect this kind of situation automatically, but this is not always possible\&.
.PP
Most options are specific to one of the forms, and will be described with that form\&. There are three options that apply to all forms\&.
.PP
\fB\-\-ctlbase\fR\ \&\fIpath\fR
.RS 4
\fIpath\fR\&.ctl is used as the UNIX domain socket for talking to
\fBpluto\fR\&. This option facilitates debugging\&.
.RE
.PP
\fB\-\-label\fR\ \&\fIstring\fR
.RS 4
adds the string to all error messages generated by
\fBwhack\fR\&.
.RE
.PP
The help form of
\fBwhack\fR
is self\-explanatory\&.
.PP
\fB\-\-help\fR
.RS 4
display the usage message\&.
.RE
.PP
\fB\-\-version\fR
.RS 4
display the version of
\fBwhack\fR\&.
.RE
.PP
The connection form describes a potential connection to
\fBpluto\fR\&.
\fBpluto\fR
needs to know what connections can and should be negotiated\&. When
\fBpluto\fR
is the initiator, it needs to know what to propose\&. When
\fBpluto\fR
is the responder, it needs to know enough to decide whether is is willing to set up the proposed connection\&.
.PP
The description of a potential connection can specify a large number of details\&. Each connection has a unique name\&. This name will appear in a updown shell command, so it should not contain punctuation that would make the command ill\-formed\&.
.PP
\fB\-\-name\fR\ \&\fIconnection\-name\fR
.RS 4
sets the name of the connection
.RE
.PP
The topology of a connection is symmetric, so to save space here is half a picture:
.PP
\ \&\ \&\ \&client_subnet<\-\->host:ikeport<\-\->nexthop<\-\-\-
.PP
A similar trick is used in the flags\&. The same flag names are used for both ends\&. Those before the
\fB\-\-to\fR
flag describe the left side and those afterwards describe the right side\&. When
\fBpluto\fR
attempts to use the connection, it decides whether it is the left side or the right side of the connection, based on the IP numbers of its interfaces\&.
.PP
\fB\-\-id\fR\ \&\fIid\fR
.RS 4
the identity of the end\&. Currently, this can be an IP address (specified as dotted quad or as a Fully Qualified Domain Name, which will be resolved immediately) or as a Fully Qualified Domain Name itself (prefixed by \(lq@\(rq to signify that it should not be resolved), or as user@FQDN, or an X\&.509 DN, or as the magic value
\fB%myid\fR\&.
\fBPluto\fR
only authenticates the identity, and does not use it for addressing, so, for example, an IP address need not be the one to which packets are to be sent\&. If the option is absent, the identity defaults to the IP address specified by
\fB\-\-host\fR\&.
\fB%myid\fR
allows the identity to be separately specified (by the
\fBpluto\fR
or
\fBwhack\fR
option
\fB\-\-myid\fR
or by the
\fBipsec.conf\fR(5)
\fBconfig setup\fR
parameter
\fImyid\fR)\&. Otherwise,
\fBpluto\fR
tries to guess what
\fB%myid\fR
should stand for: the IP address of
\fB%defaultroute\fR, if it is supported by a suitable TXT record in the reverse domain for that IP address, or the system\*(Aqs hostname, if it is supported by a suitable TXT record in its forward domain\&.
.RE
.PP
\fB\-\-host\fR\ \&\fIip\-address\fR, \fB\-\-host\fR\ \&\fB%any\fR, \fB\-\-host\fR\ \&\fB%opportunistic\fR
.RS 4
the IP address of the end (generally the public interface)\&. If
\fBpluto\fR
is to act as a responder for IKE negotiations initiated from unknown IP addresses (the \(lqRoad Warrior\(rq case), the IP address should be specified as
\fB%any\fR
(currently, the obsolete notation
0\&.0\&.0\&.0
is also accepted for this)\&. If
\fBpluto\fR
is to opportunistically initiate the connection, use
\fB%opportunistic\fR
.RE
.PP
\fB\-\-cert\fR\ \&\fIfilename\fR
.RS 4
The filename of the X\&.509 certificate\&. This must be the public key certificate only, and cannot be the PKCS#12 certificate file\&. See
\fBipsec.conf\fR(5)
on how to extrac this from the PKCS#12 file\&.
.RE
.PP
\fB\-\-ca\fR\ \&\fIdistinguished name\fR
.RS 4
the X\&.509 Certificate Authority\*(Aqs Distinguished Name (DN) used as trust anchor for this connection\&. This is the CA certificate that signed the host certificate, as well as the certificate of the incoming client\&.
.RE
.PP
\fB\-\-groups\fR\ \&\fIaccess control groups\fR
.RS 4
the access control groups used\&.
.RE
.PP
\fB\-\-sendcert\fR\ \&\fIyes|forced|always|ifasked|no|never\fR
.RS 4
Wether or not to send our X\&.509 certificate credentials\&. This could potentially give an attacker too much information about which identities are allowed to connect to this host\&. The default is to use
\fBifasked\fR
when we are a Responder, and to use
\fByes\fR
(which is the same as
\fBforced\fR
and
\fBalways\fR
if we are an Initiator\&. The values
\fBno\fR
and
\fBnever\fR
are equivalent\&. NOTE: "forced" does not seem to be actually implemented \- do not use it\&.
.RE
.PP
\fB\-\-certtype\fR\ \&\fInumber\fR
.RS 4
The X\&.509 certificate type number\&.
.RE
.PP
\fB\-\-ikeport\fR\ \&\fIport\-number\fR
.RS 4
the UDP port that IKE listens to on that host\&. The default is 500\&. (\fBpluto\fR
on this machine uses the port specified by its own command line argument, so this only affects where
\fBpluto\fR
sends messages\&.)
.RE
.PP
\fB\-\-nexthop\fR\ \&\fIip\-address\fR
.RS 4
where to route packets for the peer\*(Aqs client (presumably for the peer too, but it will not be used for this)\&. When
\fBpluto\fR
installs an IPsec SA, it issues a route command\&. It uses the nexthop as the gateway\&. The default is the peer\*(Aqs IP address (this can be explicitly written as
\fB%direct\fR; the obsolete notation
0\&.0\&.0\&.0
is accepted)\&. This option is necessary if
\fBpluto\fR\*(Aqs host\*(Aqs interface used for sending packets to the peer is neither point\-to\-point nor directly connected to the peer\&.
.RE
.PP
\fB\-\-client\fR\ \&\fIsubnet\fR
.RS 4
the subnet for which the IPsec traffic will be destined\&. If not specified, the host will be the client\&. The subnet can be specified in any of the forms supported by
\fBipsec_atosubnet\fR(3)\&. The general form is
\fIaddress\fR/\fImask\fR\&. The
\fIaddress\fR
can be either a domain name or four decimal numbers (specifying octets) separated by dots\&. The most convenient form of the
\fImask\fR
is a decimal integer, specifying the number of leading one bits in the mask\&. So, for example, 10\&.0\&.0\&.0/8 would specify the class A network \(lqNet 10\(rq\&.
.RE
.PP
\fB\-\-clientwithin\fR\ \&\fIsubnet\fR
.RS 4
This option is obsolete and will be removed\&. Do not use this option anymore\&.
.RE
.PP
\fB\-\-clientprotoport\fR\ \&\fIprotocol/port\fR
.RS 4
specify the Port Selectors (filters) to be used on this connection\&. The general form is
\fIprotocol\fR/\fIport\fR\&. This is most commonly used to limit the connection to L2TP traffic only by specifying a value of
\fI17/1701\fR
for UDP (protocol 17) and port 1701\&. The notation
\fI17/%any\fR
can be used to allow all UDP traffic and is needed for L2TP connections with Windows XP machines before Service Pack 2\&.
.RE
.PP
\fB\-\-srcip\fR\ \&\fIip\-address\fR
.RS 4
the IP address for this host to use when transmitting a packet to the remote IPsec gateway itself\&. This option is used to make the gateway itself use its internal IP, which is part of the
\fB\-\-client subnet\fR\&. Otherwise it will use its nearest IP address, which is its public IP address, which is not part of the subnet\-subnet IPsec tunnel, and would therefor not get encrypted\&.
.RE
.PP
\fB\-\-xauthserver\fR
.RS 4
this end is an xauthserver\&. It will lookup the xauth user name and password and verify this before allowing the connection to get established\&.
.RE
.PP
\fB\-\-xauthclient\fR
.RS 4
this end is an xauthclient\&. To bring this connection up with the
\fB\-\-initiate\fR
also requires the client to specify
\fB\-\-xauthuser username\fR
and
\fB\-\-xauthpass password \fR
.RE
.PP
\fB\-\-xauthuser\fR
.RS 4
The username for the xauth authentication\&.This option is normally passed along by
\fBipsec_auto\fR(8)
when an xauth connection is started using
\fIipsec auto \-\-up conn\fR
.RE
.PP
\fB\-\-xauthpass\fR
.RS 4
The password for the xauth authentication\&. This option is normally passed along by
\fBipsec_auto\fR(8)
when an xauth connection is started using
\fIipsec auto \-\-up conn\fR
.RE
.PP
\fB\-\-modecfgserver\fR
.RS 4
this end is an Mode Config server
.RE
.PP
\fB\-\-modecfgclient\fR
.RS 4
this end is an Mode Config client
.RE
.PP
\fB\-\-modecfgdns1\fR
.RS 4
The IP address of the first DNS server to pass along to the ModeConfig Client
.RE
.PP
\fB\-\-modecfgdns2\fR
.RS 4
The IP address of the second DNS server to pass along to the ModeConfig Client
.RE
.PP
\fB\-\-modecfgwins1\fR
.RS 4
The IP address of the first WINS server to pass along to the ModeConfig Client
.RE
.PP
\fB\-\-modecfgwins2\fR
.RS 4
The IP address of the second WINS server to pass along to the ModeConfig Client
.RE
.PP
\fB\-\-dnskeyondemand\fR
.RS 4
specifies that when an RSA public key is needed to authenticate this host, and it isn\*(Aqt already known, fetch it from DNS\&.
.RE
.PP
\fB\-\-updown\fR\ \&\fIupdown\fR
.RS 4
specifies an external shell command to be run whenever
\fBpluto\fR
brings up or down a connection\&. The script is used to build a shell command, so it may contain positional parameters, but ought not to have punctuation that would cause the resulting command to be ill\-formed\&. The default is
\fIipsec _updown\fR\&. Pluto passes a dozen environment variables to the script about the connection involved\&.
.RE
.PP
\fB\-\-to\fR
.RS 4
separates the specification of the left and right ends of the connection\&. Pluto tries to decide wether it is
\fIleft\fR
or
\fIright\fR
based on the information provided on both sides of this option\&.
.RE
.PP
The potential connection description also specifies characteristics of rekeying and security\&.
.PP
\fB\-\-psk\fR
.RS 4
Propose and allow preshared secret authentication for IKE peers\&. This authentication requires that each side use the same secret\&. May be combined with
\fB\-\-rsasig\fR; at least one must be specified\&.
.RE
.PP
\fB\-\-rsasig\fR
.RS 4
Propose and allow RSA signatures for authentication of IKE peers\&. This authentication requires that each side have have a private key of its own and know the public key of its peer\&. May be combined with
\fB\-\-psk\fR; at least one must be specified\&.
.RE
.PP
\fB\-\-encrypt\fR
.RS 4
All proposed or accepted IPsec SAs will include non\-null ESP\&. The actual choices of transforms are wired into
\fBpluto\fR\&.
.RE
.PP
\fB\-\-authenticate\fR
.RS 4
All proposed IPsec SAs will include AH\&. All accepted IPsec SAs will include AH or ESP with authentication\&. The actual choices of transforms are wired into
\fBpluto\fR\&. Note that this has nothing to do with IKE authentication\&.
.RE
.PP
\fB\-\-compress\fR
.RS 4
All proposed IPsec SAs will include IPCOMP (compression)\&. This will be ignored if KLIPS is not configured with IPCOMP support\&.
.RE
.PP
\fB\-\-tunnel\fR
.RS 4
the IPsec SA should use tunneling\&. Implicit if the SA is for clients\&. Must only be used with
\fB\-\-authenticate\fR
or
\fB\-\-encrypt\fR\&.
.RE
.PP
\fB\-\-ipv4\fR
.RS 4
The host addresses will be interpreted as IPv4 addresses\&. This is the default\&. Note that for a connection, all host addresses must be of the same Address Family (IPv4 and IPv6 use different Address Families)\&.
.RE
.PP
\fB\-\-ipv6\fR
.RS 4
The host addresses (including nexthop) will be interpreted as IPv6 addresses\&. Note that for a connection, all host addresses must be of the same Address Family (IPv4 and IPv6 use different Address Families)\&.
.RE
.PP
\fB\-\-tunnelipv4\fR
.RS 4
The client addresses will be interpreted as IPv4 addresses\&. The default is to match what the host will be\&. This does not imply
\fB\-\-tunnel\fR
so the flag can be safely used when no tunnel is actually specified\&. Note that for a connection, all tunnel addresses must be of the same Address Family\&.
.RE
.PP
\fB\-\-tunnelipv6\fR
.RS 4
The client addresses will be interpreted as IPv6 addresses\&. The default is to match what the host will be\&. This does not imply
\fB\-\-tunnel\fR
so the flag can be safely used when no tunnel is actually specified\&. Note that for a connection, all tunnel addresses must be of the same Address Family\&.
.RE
.PP
\fB\-\-pfs\fR
.RS 4
There should be Perfect Forward Secrecy \- new keying material will be generated for each IPsec SA rather than being derived from the ISAKMP SA keying material\&. Since the group to be used cannot be negotiated (a dubious feature of the standard),
\fBpluto\fR
will propose the same group that was used during Phase 1\&. We don\*(Aqt implement a stronger form of PFS which would require that the ISAKMP SA be deleted after the IPSEC SA is negotiated\&.
.RE
.PP
\fB\-\-pfsgroup\fR\ \&\fImodp\-group\fR
.RS 4
Sets the Diffie\-Hellman group used\&. Currently the following values are supported:
\fBmodp1024\fR
(DHgroup 2),
\fBmodp1536\fR
(DHgroup 5),
\fBmodp2048\fR
(DHgroup 14),
\fBmodp3072\fR
(DHgroup 15),
\fBmodp4096\fR
(DHgroup 16),
\fBmodp6144\fR
(DHgroup 17), and
\fBmodp8192\fR
(DHgroup 18)\&. It is possible to support the weak and broken
\fBmodp768\fR
(DHgroup 1), but this requires a manual recompile and is strongly discouraged\&.
.RE
.PP
\fB\-\-disablearrivalcheck\fR
.RS 4
If the connection is a tunnel, allow packets arriving through the tunnel to have any source and destination addresses\&.
.RE
.PP
\fB\-\-esp\fR\ \&\fIesp\-algos\fR
.RS 4
ESP encryption/authentication algorithm to be used for the connection (phase2 aka IPsec SA)\&. The options must be suitable as a value of
\fBipsec_spi\fR(8)\&. See
\fBipsec.conf\fR(5)
for a detailed description of the algorithm format\&.
.RE
.PP
\fB\-\-aggrmode\fR
.RS 4
This tunnel is using aggressive mode ISAKMP negotiation\&. The default is main mode\&. Aggressive mode is less secure than main mode as it reveals your identity to an eavesdropper, but is needed to support road warriors using PSK keys or to interoperate with other buggy implementations insisting on using aggressive mode\&.
.RE
.PP
\fB\-\-modecfgpull\fR
.RS 4
Pull the Mode Config network information from the peer\&.
.RE
.PP
\fB\-\-dpddelay\fR\ \&\fIseconds\fR
.RS 4
Set the delay (in seconds) between Dead Peer Dectection (RFC 3706) keepalives (R_U_THERE, R_U_THERE_ACK) that are sent for this connection (default 30 seconds)\&.
.RE
.PP
\fB\-\-timeout\fR\ \&\fIseconds\fR
.RS 4
Set the length of time (in seconds) we will idle without hearing either an R_U_THERE poll from our peer, or an R_U_THERE_ACK reply\&. After this period has elapsed with no response and no traffic, we will declare the peer dead, and remove the SA (default 120 seconds)\&.
.RE
.PP
\fB\-\-dpdaction\fR\ \&\fIaction\fR
.RS 4
When a DPD enabled peer is declared dead, what action should be taken\&.
\fBhold\fR(default) means the eroute will be put into
\fI%hold\fR
status, while
\fBclear\fRmeans the eroute and SA with both be cleared\&. Clear is really only useful on the server of a Road Warrior config\&. The action
\fBrestart\fR
is used on tunnels that need to be permanently up, and have static IP addresses\&.
.RE
.PP
\fB\-\-forceencaps\fR
.RS 4
In some cases, for example when ESP packets are filtered or when a broken IPsec peer does not properly recognise NAT, it can be useful to force RFC\-3948 encapsulation using this option\&. It causes pluto lie and tell the remote peer that RFC\-3948 encapsulation (ESP in UDP port 4500 packets) is required\&. For this option to have any effect, pluto must have been started with the
\fB\-\-nat_traversal\fR
option\&.
.RE
.PP
If none of the
\fB\-\-encrypt\fR,
\fB\-\-authenticate\fR,
\fB\-\-compress\fR, or
\fB\-\-pfs\fR
flags is given, the initiating the connection will only build an ISAKMP SA\&. For such a connection, client subnets have no meaning and must not be specified\&.
.PP
Apart from initiating directly using the
\fB\-\-initiate\fR
option, a tunnel can be loaded with a different policy
.PP
\fB\-\-initiateontraffic\fR
.RS 4
Only initiate the connection when we have traffic to send over the connection
.RE
.PP
\fB\-\-pass\fR
.RS 4
Allow
\fBunencrypted\fR
traffic to flow until the tunnel is initiated\&.
.RE
.PP
\fB\-\-drop\fR
.RS 4
Drop unencrypted traffic silently\&.
.RE
.PP
\fB\-\-reject\fR
.RS 4
Drop unencrypted traffic silently, but send an ICMP message notifying the other end\&.
.RE
.PP
These options need to be documented
.PP
\fB\-\-failnone\fR
.RS 4
to be documented
.RE
.PP
\fB\-\-failpass\fR
.RS 4
to be documented
.RE
.PP
\fB\-\-faildrop\fR
.RS 4
to be documented
.RE
.PP
\fB\-\-failreject\fR
.RS 4
to be documented
.RE
.PP
\fBpluto\fR
supports various X\&.509 Certificate related options\&.
.PP
\fB\-\-utc\fR
.RS 4
display all times in UTC\&.
.RE
.PP
\fB\-\-listall\fR
.RS 4
lists all of the X\&.509 information known to pluto\&.
.RE
.PP
\fB\-\-listpubkeys\fR
.RS 4
list all the public keys that have been successfully loaded\&.
.RE
.PP
\fB\-\-listcerts\fR
.RS 4
list all the X\&.509 certificates that are currently loaded\&.
.RE
.PP
\fB\-\-checkpubkeys\fR
.RS 4
list all the loaded X\&.509 certificates which are about to expire or have been expired\&.
.RE
.PP
\fB\-\-listcacerts\fR
.RS 4
list all the X\&.509 Certificate Authority (CA) certificates that are currently loaded\&.
.RE
.PP
\fB\-\-listacerts\fR
.RS 4
list all the X\&.509 Attribute certificates that are currently loaded
.RE
.PP
\fB\-\-listaacerts\fR
.RS 4
.RE
.PP
\fB\-\-listgroups\fR
.RS 4
.RE
.PP
\fB\-\-listcrls\fR
.RS 4
list all the loaded
\fICertificate Revocation Lists\fR
(CRLs)
.RE
.PP
The corresponding options
\fB\-\-rereadsecrets\fR,
\fB\-\-rereadall\fR,
\fB\-\-rereadcacerts\fR,
\fB\-\-rereadacerts\fR,
\fB\-\-rereadaacerts\fR, and
\fB\-\-rereadcrls\fR
options reread this information from their respective sources, and purge all the online obtained information\&. The option
\fB\-\-listevents\fR
lists all pending CRL fetch commands\&.
.PP
More work is needed to allow for flexible policies\&. Currently policy is hardwired in the source file spdb\&.c\&. The ISAKMP SAs may use Oakley groups MODP1024 and MODP1536; AES or 3DES encryption; SHA1\-96 and MD5\-96 authentication\&. The IPsec SAs may use AES or 3DES and MD5\-96 or SHA1\-96 for ESP, or just MD5\-96 or SHA1\-96 for AH\&. IPCOMP Compression is always Deflate\&.
.PP
\fB\-\-ikelifetime\fR\ \&\fIseconds\fR
.RS 4
how long
\fBpluto\fR
will propose that an ISAKMP SA be allowed to live\&. The default is 3600 (one hour) and the maximum is 86400 (1 day)\&. This option will not affect what is accepted\&.
\fBpluto\fR
will reject proposals that exceed the maximum\&.
.RE
.PP
\fB\-\-ipseclifetime\fR\ \&\fIseconds\fR
.RS 4
how long
\fBpluto\fR
will propose that an IPsec SA be allowed to live\&. The default is 28800 (eight hours) and the maximum is 86400 (one day)\&. This option will not affect what is accepted\&.
\fBpluto\fR
will reject proposals that exceed the maximum\&.
.RE
.PP
\fB\-\-rekeymargin\fR\ \&\fIseconds\fR
.RS 4
how long before an SA\*(Aqs expiration should
\fBpluto\fR
try to negotiate a replacement SA\&. This will only happen if
\fBpluto\fR
was the initiator\&. The default is 540 (nine minutes)\&.
.RE
.PP
\fB\-\-rekeyfuzz\fR\ \&\fIpercentage\fR
.RS 4
maximum size of random component to add to rekeymargin, expressed as a percentage of rekeymargin\&.
\fBpluto\fR
will select a delay uniformly distributed within this range\&. By default, the percentage will be 100\&. If greater determinism is desired, specify 0\&. It may be appropriate for the percentage to be much larger than 100\&.
.RE
.PP
\fB\-\-keyingtries\fR\ \&\fIcount\fR
.RS 4
how many times
\fBpluto\fR
should try to negotiate an SA, either for the first time or for rekeying\&. A value of 0 is interpreted as a very large number: never give up\&. The default is three\&.
.RE
.PP
\fB\-\-dontrekey\fR
.RS 4
A misnomer\&. Only rekey a connection if we were the Initiator and there was recent traffic on the existing connection\&. This applies to Phase 1 and Phase 2\&. This is currently the only automatic way for a connection to terminate\&. It may be useful with Road Warrior or Opportunistic connections\&.
Since SA lifetime negotiation is take\-it\-or\-leave it, a Responder normally uses the shorter of the negotiated or the configured lifetime\&. This only works because if the lifetime is shorter than negotiated, the Responder will rekey in time so that everything works\&. This interacts badly with
\fB\-\-dontrekey\fR\&. In this case, the Responder will end up rekeying to rectify a shortfall in an IPsec SA lifetime; for an ISAKMP SA, the Responder will accept the negotiated lifetime\&.
.RE
.PP
\fB\-\-delete\fR
.RS 4
when used in the connection form, it causes any previous connection with this name to be deleted before this one is added\&. Unlike a normal delete, no diagnostic is produced if there was no previous connection to delete\&. Any routing in place for the connection is undone\&.
.RE
.PP
\fB\-\-delete\fR, \fB\-\-name\fR\ \&\fIconnection\-name\fR
.RS 4
The delete form deletes a named connection description and any SAs established or negotiations initiated using this connection\&. Any routing in place for the connection is undone\&.
.RE
.PP
\fB\-\-deletestate\fR\ \&\fIstate\-number\fR
.RS 4
The deletestate form deletes the state object with the specified serial number\&. This is useful for selectively deleting instances of connections\&.
.RE
.PP
The route form of the
\fBwhack\fR
command tells
\fBpluto\fR
to set up routing for a connection\&. Although like a traditional route, it uses an ipsec device as a virtual interface\&. Once routing is set up, no packets will be sent \(lqin the clear\(rq to the peer\*(Aqs client specified in the connection\&. A TRAP shunt eroute will be installed; if outbound traffic is caught, Pluto will initiate the connection\&. An explicit
\fBwhack\fR
route is not always needed: if it hasn\*(Aqt been done when an IPsec SA is being installed, one will be automatically attempted\&.
.PP
\fB\-\-route\fR, \fB\-\-name\fR\ \&\fIconnection\-name\fR
.RS 4
When a routing is attempted for a connection, there must not already be a routing for a different connection with the same subnet but different interface or destination, or if there is, it must not be being used by an IPsec SA\&. Otherwise the attempt will fail\&.
.RE
.PP
\fB\-\-unroute\fR, \fB\-\-name\fR\ \&\fIconnection\-name\fR
.RS 4
The unroute form of the
\fBwhack\fR
command tells
\fBpluto\fR
to undo a routing\&.
\fBpluto\fR
will refuse if an IPsec SA is using the connection\&. If another connection is sharing the same routing, it will be left in place\&. Without a routing, packets will be sent without encryption or authentication\&.
.RE
.PP
The initiate form tells
\fBpluto\fR
to initiate a negotiation with another
\fBpluto\fR
(or other IKE daemon) according to the named connection\&. Initiation requires a route that
\fB\-\-route\fR
would provide; if none is in place at the time an IPsec SA is being installed,
\fBpluto\fR
attempts to set one up\&.
.PP
\fB\-\-initiate\fR, \fB\-\-name\fR\ \&\fIconnection\-name\fR, \fB\-\-asynchronous\fR
.RS 4
The initiate form of the
\fBwhack\fR
command will relay back from
\fBpluto\fR
status information via the UNIX domain socket (unless \-\-asynchronous is specified)\&. The status information is meant to look a bit like that from
\fBFTP\fR\&. Currently
\fBwhack\fR
simply copies this to stderr\&. When the request is finished (eg\&. the SAs are established or
\fBpluto\fR
gives up),
\fBpluto\fR
closes the channel, causing
\fBwhack\fR
to terminate\&.
.RE
.PP
The opportunistic initiate form is mainly used for debugging\&.
.PP
\fB\-\-tunnelipv4\fR, \fB\-\-tunnelipv6\fR, \fB\-\-oppohere\fR\ \&\fIip\-address\fR, \fB\-\-oppothere\fR\ \&\fIip\-address\fR
.RS 4
This will cause
\fBpluto\fR
to attempt to opportunistically initiate a connection from here to the there, even if a previous attempt had been made\&. The whack log will show the progress of this attempt\&.
.RE
.PP
Ending an connection
.PP
\fB\-\-terminate\fR, \fB\-\-name\fR\ \&\fIconnection\-name\fR
.RS 4
the terminate form tells
\fIpluto\fR
to delete any sas that use the specified connection and to stop any negotiations in process\&. it does not prevent new negotiations from starting (the delete form has this effect)\&.
.RE
.PP
\fB\-\-crash\fR\ \&\fIip\-address\fR
.RS 4
If the remote peer has crashed, and therefor did not notify us, we keep sending encrypted traffic, and rejecting all plaintext (non\-IKE) traffic from that remote peer\&. The
\fB\-\-crash\fR
brings our end down as well for all the known connections to the specified
\fIip\-address\fR
.RE
.PP
\fB\-\-whackrecord\fR\fIfilename\fR, \fB\-\-whackstoprecord\fR
.RS 4
this causes
\fIpluto\fRto open the given filename for write, and record each of the messages received from whack or addconn\&. This continues until the whackstoprecord option is used\&. This option may not be combined with any other command\&. The start/stop commands are not recorded themselves\&. These files are usually used to create input files for unit tests, particularly for complex setups where policies may in fact overlap\&.
.sp
The format of the file consists of a line starting with #!pluto\-whack and the date that the file was started, as well as the hostname, and a linefeed\&. What follows are binary format records consisting of a 32\-bit record length in bytes, (including the length record itself), a 64\-bit timestamp, and then the literal contents of the whack message that was received\&. All integers are in host format\&. In order to unambigously determine the host order, the first record is an empty record that contains only the current WHACK_MAGIC value\&. This record is 16 bytes long\&.
.RE
.PP
\fIip\-address\fR
.RS 4
If the remote peer has crashed, and therefor did not notify us, we keep sending encrypted traffic, and rejecting all plaintext (non\-IKE) traffic from that remote peer\&. The
\fB\-\-crash\fR
brings our end down as well for all the known connections to the specified
\fIip\-address\fR
.RE
.PP
The public key for informs
\fBpluto\fR
of the RSA public key for a potential peer\&. Private keys must be kept secret, so they are kept in
\fBipsec.secrets\fR(5)\&.
.PP
\fB\-\-keyid\ \&\fR\fIid\fR
.RS 4
specififies the identity of the peer for which a public key should be used\&. Its form is identical to the identity in the connection\&. If no public key is specified,
\fBpluto\fR
attempts to find KEY records from DNS for the id (if a FQDN) or through reverse lookup (if an IP address)\&. Note that there several interesting ways in which this is not secure\&.
.RE
.PP
\fB\-\-addkey\fR
.RS 4
specifies that the new key is added to the collection; otherwise the new key replaces any old ones\&.
.RE
.PP
\fB\-\-pubkeyrsa\ \&\fR\fIkey\fR
.RS 4
specifies the value of the RSA public key\&. It is a sequence of bytes as described in RFC 2537 \(lqRSA/MD5 KEYs and SIGs in the Domain Name System (DNS)\(rq\&. It is denoted in a way suitable for
\fBipsec_ttodata\fR(3)\&. For example, a base 64 numeral starts with 0s\&.
.RE
.PP
The listen form tells
\fBpluto\fR
to start listening for IKE requests on its public interfaces\&. To avoid race conditions, it is normal to load the appropriate connections into
\fBpluto\fR
before allowing it to listen\&. If
\fBpluto\fR
isn\*(Aqt listening, it is pointless to initiate negotiations, so it will refuse requests to do so\&. Whenever the listen form is used,
\fBpluto\fR
looks for public interfaces and will notice when new ones have been added and when old ones have been removed\&. This is also the trigger for
\fBpluto\fR
to read the
\fIipsec\&.secrets\fR
file\&. So listen may useful more than once\&.
.PP
\fB\-\-listen\fR
.RS 4
start listening for IKE traffic on public interfaces\&.
.RE
.PP
\fB\-\-unlisten\fR
.RS 4
stop listening for IKE traffic on public interfaces\&.
.RE
.PP
The status form will display information about the internal state of
\fBpluto\fR: information about each potential connection, about each state object, and about each shunt that
\fBpluto\fR
is managing without an associated connection\&.
.PP
\fB\-\-status\fR
.RS 4
.RE
.PP
The shutdown form is the proper way to shut down
\fBpluto\fR\&. It will tear down the SAs on this machine that
\fBpluto\fR
has negotiated\&. It does not inform its peers, so the SAs on their machines remain\&.
.PP
\fB\-\-shutdown\fR
.RS 4
.RE
.SS "Examples"
.PP
It would be normal to start
\fBpluto\fR
in one of the system initialization scripts\&. It needs to be run by the superuser\&. Generally, no arguments are needed\&. To run in manually, the superuser can simply type
.PP
\ \&\ \&\ \&ipsec pluto
.PP
The command will immediately return, but a
\fBpluto\fR
process will be left running, waiting for requests from
\fBwhack\fR
or a peer\&.
.PP
Using
\fBwhack\fR, several potential connections would be described:
.PP
\ \&\ \&\ \&ipsec whack \-\-name\ \&silly \-\-host\ \&127\&.0\&.0\&.1 \-\-to \-\-host\ \&127\&.0\&.0\&.2 \-\-ikelifetime\ \&900 \-\-ipseclifetime\ \&800 \-\-keyingtries\ \&3
.PP
Since this silly connection description specifies neither encryption, authentication, nor tunneling, it could only be used to establish an ISAKMP SA\&.
.PP
\ \&\ \&\ \&ipsec whack \-\-name\ \&conn_name \-\-host\ \&10\&.0\&.0\&.1 \-\-client\ \&10\&.0\&.1\&.0/24 \-\-to \-\-host\ \&10\&.0\&.0\&.2 \-\-client\ \&10\&.0\&.2\&.0/24 \-\-encrypt
.PP
This is something that must be done on both sides\&. If the other side is
\fBpluto\fR, the same
\fBwhack\fR
command could be used on it (the command syntax is designed to not distinguish which end is ours)\&.
.PP
Now that the connections are specified,
\fBpluto\fR
is ready to handle requests and replies via the public interfaces\&. We must tell it to discover those interfaces and start accepting messages from peers:
.PP
\ \&\ \&\ \&ipsec whack \-\-listen
.PP
If we don\*(Aqt immediately wish to bring up a secure connection between the two clients, we might wish to prevent insecure traffic\&. The routing form asks
\fBpluto\fR
to cause the packets sent from our client to the peer\*(Aqs client to be routed through the ipsec0 device; if there is no SA, they will be discarded:
.PP
\ \&\ \&\ \&ipsec whack \-\-route conn_name
.PP
Finally, we are ready to get
\fBpluto\fR
to initiate negotiation for an IPsec SA (and implicitly, an ISAKMP SA):
.PP
\ \&\ \&\ \&ipsec whack \-\-initiate\ \&\-\-name\ \&conn_name
.PP
A small log of interesting events will appear on standard output (other logging is sent to syslog)\&.
.PP
\fBwhack\fR
can also be used to terminate
\fBpluto\fR
cleanly, tearing down all SAs that it has negotiated\&.
.PP
\ \&\ \&\ \&ipsec whack \-\-shutdown
.PP
Notification of any IPSEC SA deletion, but not ISAKMP SA deletion is sent to the peer\&. Unfortunately, such Notification is not reliable\&. Furthermore,
\fBpluto\fR
itself ignores Notifications\&.
.SS "XAUTH"
.PP
If
\fBpluto\fR
needs additional authentication, such as defined by the XAUTH specifications, then it may ask
\fBwhack\fR
to prompt the operator for username or passwords\&. Typically, these will be entered interactively\&. A GUI that wraps around
\fBwhack\fR
may look for the 041 (username) or 040 (password) prompts, and display them to the user\&.
.PP
For testing purposes, the options
\fB\-\-xauthuser\ \&\fR\fIuser\fR
\fB\-\-xauthpass\ \&\fR\fIpass\fR
may be be given prior to the
\fB\-\-initiate\ \&\fR
to provide responses to the username and password prompts\&.
.SS "The updown command"
.PP
Whenever
\fBpluto\fR
brings a connection up or down, it invokes the updown command\&. This command is specified using the
\fB\-\-updown\fR
option\&. This allows for customized control over routing and firewall manipulation\&.
.PP
The updown is invoked for five different operations\&. Each of these operations can be for our client subnet or for our host itself\&.
.PP
\fBprepare\-host\fR or \fBprepare\-client\fR
.RS 4
is run before bringing up a new connection if no other connection with the same clients is up\&. Generally, this is useful for deleting a route that might have been set up before
\fBpluto\fR
was run or perhaps by some agent not known to
\fBpluto\fR\&.
.RE
.PP
\fBroute\-host\fR or \fBroute\-client\fR
.RS 4
is run when bringing up a connection for a new peer client subnet (even if
\fBprepare\-host\fR
or
\fBprepare\-client\fR
was run)\&. The command should install a suitable route\&. Routing decisions are based only on the destination (peer\*(Aqs client) subnet address, unlike eroutes which discriminate based on source too\&.
.RE
.PP
\fBunroute\-host\fR or \fBunroute\-client\fR
.RS 4
is run when bringing down the last connection for a particular peer client subnet\&. It should undo what the
\fBroute\-host\fR
or
\fBroute\-client\fR
did\&.
.RE
.PP
\fBup\-host\fR or \fBup\-client\fR
.RS 4
is run when bringing up a tunnel eroute with a pair of client subnets that does not already have a tunnel eroute\&. This command should install firewall rules as appropriate\&. It is generally a good idea to allow IKE messages (UDP port 500) travel between the hosts\&.
.RE
.PP
\fBdown\-host\fR or \fBdown\-client\fR
.RS 4
is run when bringing down the eroute for a pair of client subnets\&. This command should delete firewall rules as appropriate\&. Note that there may remain some inbound IPsec SAs with these client subnets\&.
.RE
.PP
The script is passed a large number of environment variables to specify what needs to be done\&.
.PP
\fBPLUTO_VERSION\fR
.RS 4
indicates what version of this interface is being used\&. This document describes version 1\&.1\&. This is upwardly compatible with version 1\&.0\&.
.RE
.PP
\fBPLUTO_VERB\fR
.RS 4
specifies the name of the operation to be performed (\fBprepare\-host\fR,r
\fBprepare\-client\fR,
\fBup\-host\fR,
\fBup\-client\fR,
\fBdown\-host\fR, or
\fBdown\-client\fR)\&. If the address family for security gateway to security gateway communications is IPv6, then a suffix of \-v6 is added to the verb\&.
.RE
.PP
\fBPLUTO_CONNECTION\fR
.RS 4
is the name of the connection for which we are routing\&.
.RE
.PP
\fBPLUTO_NEXT_HOP\fR
.RS 4
is the next hop to which packets bound for the peer must be sent\&.
.RE
.PP
\fBPLUTO_INTERFACE\fR
.RS 4
is the name of the ipsec interface to be used\&.
.RE
.PP
\fBPLUTO_ME\fR
.RS 4
is the IP address of our host\&.
.RE
.PP
\fBPLUTO_MY_CLIENT\fR
.RS 4
is the IP address / count of our client subnet\&. If the client is just the host, this will be the host\*(Aqs own IP address / max (where max is 32 for IPv4 and 128 for IPv6)\&.
.RE
.PP
\fBPLUTO_MY_CLIENT_NET\fR
.RS 4
is the IP address of our client net\&. If the client is just the host, this will be the host\*(Aqs own IP address\&.
.RE
.PP
\fBPLUTO_MY_CLIENT_MASK\fR
.RS 4
is the mask for our client net\&. If the client is just the host, this will be 255\&.255\&.255\&.255\&.
.RE
.PP
\fBPLUTO_PEER\fR
.RS 4
is the IP address of our peer\&.
.RE
.PP
\fBPLUTO_PEER_CLIENT\fR
.RS 4
is the IP address / count of the peer\*(Aqs client subnet\&. If the client is just the peer, this will be the peer\*(Aqs own IP address / max (where max is 32 for IPv4 and 128 for IPv6)\&.
.RE
.PP
\fBPLUTO_PEER_CLIENT_NET\fR
.RS 4
is the IP address of the peer\*(Aqs client net\&. If the client is just the peer, this will be the peer\*(Aqs own IP address\&.
.RE
.PP
\fBPLUTO_PEER_CLIENT_MASK\fR
.RS 4
is the mask for the peer\*(Aqs client net\&. If the client is just the peer, this will be 255\&.255\&.255\&.255\&.
.RE
.PP
\fBPLUTO_MY_PROTOCOL\fR
.RS 4
lists the protocols allowed over this IPsec SA\&.
.RE
.PP
\fBPLUTO_PEER_PROTOCOL\fR
.RS 4
lists the protocols the peer allows over this IPsec SA\&.
.RE
.PP
\fBPLUTO_MY_PORT\fR
.RS 4
lists the ports allowed over this IPsec SA\&.
.RE
.PP
\fBPLUTO_PEER_PORT\fR
.RS 4
lists the ports the peer allows over this IPsec SA\&.
.RE
.PP
\fBPLUTO_MY_ID\fR
.RS 4
lists our id\&.
.RE
.PP
\fBPLUTO_PEER_ID\fR
.RS 4
Dlists our peer\*(Aqs id\&.
.RE
.PP
\fBPLUTO_PEER_CA\fR
.RS 4
lists the peer\*(Aqs CA\&.
.RE
.PP
All output sent by the script to stderr or stdout is logged\&. The script should return an exit status of 0 if and only if it succeeds\&.
.PP
\fBPluto\fR
waits for the script to finish and will not do any other processing while it is waiting\&. The script may assume that
\fBpluto\fR
will not change anything while the script runs\&. The script should avoid doing anything that takes much time and it should not issue any command that requires processing by
\fBpluto\fR\&. Either of these activities could be performed by a background subprocess of the script\&.
.SS "Rekeying"
.PP
When an SA that was initiated by
\fBpluto\fR
has only a bit of lifetime left,
\fBpluto\fR
will initiate the creation of a new SA\&. This applies to ISAKMP and IPsec SAs\&. The rekeying will be initiated when the SA\*(Aqs remaining lifetime is less than the rekeymargin plus a random percentage, between 0 and rekeyfuzz, of the rekeymargin\&.
.PP
Similarly, when an SA that was initiated by the peer has only a bit of lifetime left,
\fBpluto\fR
will try to initiate the creation of a replacement\&. To give preference to the initiator, this rekeying will only be initiated when the SA\*(Aqs remaining lifetime is half of rekeymargin\&. If rekeying is done by the responder, the roles will be reversed: the responder for the old SA will be the initiator for the replacement\&. The former initiator might also initiate rekeying, so there may be redundant SAs created\&. To avoid these complications, make sure that rekeymargin is generous\&.
.PP
One risk of having the former responder initiate is that perhaps none of its proposals is acceptable to the former initiator (they have not been used in a successful negotiation)\&. To reduce the chances of this happening, and to prevent loss of security, the policy settings are taken from the old SA (this is the case even if the former initiator is initiating)\&. These may be stricter than those of the connection\&.
.PP
\fBpluto\fR
will not rekey an SA if that SA is not the most recent of its type (IPsec or ISAKMP) for its potential connection\&. This avoids creating redundant SAs\&.
.PP
The random component in the rekeying time (rekeyfuzz) is intended to make certain pathological patterns of rekeying unstable\&. If both sides decide to rekey at the same time, twice as many SAs as necessary are created\&. This could become a stable pattern without the randomness\&.
.PP
Another more important case occurs when a security gateway has SAs with many other security gateways\&. Each of these connections might need to be rekeyed at the same time\&. This would cause a high peek requirement for resources (network bandwidth, CPU time, entropy for random numbers)\&. The rekeyfuzz can be used to stagger the rekeying times\&.
.PP
Once a new set of SAs has been negotiated,
\fBpluto\fR
will never send traffic on a superseded one\&. Traffic will be accepted on an old SA until it expires\&.
.SS "Selecting a Connection When Responding: Road Warrior Support"
.PP
When
\fBpluto\fR
receives an initial Main Mode message, it needs to decide which connection this message is for\&. It picks based solely on the source and destination IP addresses of the message\&. There might be several connections with suitable IP addresses, in which case one of them is arbitrarily chosen\&. (The ISAKMP SA proposal contained in the message could be taken into account, but it is not\&.)
.PP
The ISAKMP SA is negotiated before the parties pass further identifying information, so all ISAKMP SA characteristics specified in the connection description should be the same for every connection with the same two host IP addresses\&. At the moment, the only characteristic that might differ is authentication method\&.
.PP
Up to this point, all configuring has presumed that the IP addresses are known to all parties ahead of time\&. This will not work when either end is mobile (or assigned a dynamic IP address for other reasons)\&. We call this situation \(lqRoad Warrior\(rq\&. It is fairly tricky and has some important limitations, most of which are features of the IKE protocol\&.
.PP
Only the initiator may be mobile: the initiator may have an IP number unknown to the responder\&. When the responder doesn\*(Aqt recognize the IP address on the first Main Mode packet, it looks for a connection with itself as one end and
\fB%any\fR
as the other\&. If it cannot find one, it refuses to negotiate\&. If it does find one, it creates a temporary connection that is a duplicate except with the
\fB%any\fR
replaced by the source IP address from the packet; if there was no identity specified for the peer, the new IP address will be used\&.
.PP
When
\fBpluto\fR
is using one of these temporary connections and needs to find the preshared secret or RSA private key in
\fIipsec\&.secrets\fR, and and the connection specified no identity for the peer,
\fB%any\fR
is used as its identity\&. After all, the real IP address was apparently unknown to the configuration, so it is unreasonable to require that it be used in this table\&.
.PP
Part way into the Phase 1 (Main Mode) negotiation using one of these temporary connection descriptions,
\fBpluto\fR
will be receive an Identity Payload\&. At this point,
\fBpluto\fR
checks for a more appropriate connection, one with an identity for the peer that matches the payload but which would use the same keys so\-far used for authentication\&. If it finds one, it will switch to using this better connection (or a temporary derived from this, if it has
\fB%any\fR
for the peer\*(Aqs IP address)\&. It may even turn out that no connection matches the newly discovered identity, including the current connection; if so,
\fBpluto\fR
terminates negotiation\&.
.PP
Unfortunately, if preshared secret authentication is being used, the Identity Payload is encrypted using this secret, so the secret must be selected by the responder without knowing this payload\&. This limits there to being at most one preshared secret for all Road Warrior systems connecting to a host\&. RSA Signature authentications does not require that the responder know how to select the initiator\*(Aqs public key until after the initiator\*(Aqs Identity Payload is decoded (using the responder\*(Aqs private key, so that must be preselected)\&.
.PP
When
\fBpluto\fR
is responding to a Quick Mode negotiation via one of these temporary connection descriptions, it may well find that the subnets specified by the initiator don\*(Aqt match those in the temporary connection description\&. If so, it will look for a connection with matching subnets, its own host address, a peer address of
\fB%any\fR
and matching identities\&. If it finds one, a new temporary connection is derived from this one and used for the Quick Mode negotiation of IPsec SAs\&. If it does not find one,
\fBpluto\fR
terminates negotiation\&.
.PP
Be sure to specify an appropriate nexthop for the responder to send a message to the initiator:
\fBpluto\fR
has no way of guessing it (if forwarding isn\*(Aqt required, use an explicit
\fB%direct\fR
as the nexthop and the IP address of the initiator will be filled in; the obsolete notation
0\&.0\&.0\&.0
is still accepted)\&.
.PP
\fBpluto\fR
has no special provision for the initiator side\&. The current (possibly dynamic) IP address and nexthop must be used in defining connections\&. These must be properly configured each time the initiator\*(Aqs IP address changes\&.
\fBpluto\fR
has no mechanism to do this automatically\&.
.PP
Although we call this Road Warrior Support, it could also be used to support encrypted connections with anonymous initiators\&. The responder\*(Aqs organization could announce the preshared secret that would be used with unrecognized initiators and let anyone connect\&. Of course the initiator\*(Aqs identity would not be authenticated\&.
.PP
If any Road Warrior connections are supported,
\fBpluto\fR
cannot reject an exchange initiated by an unknown host until it has determined that the secret is not shared or the signature is invalid\&. This must await the third Main Mode message from the initiator\&. If no Road Warrior connection is supported, the first message from an unknown source would be rejected\&. This has implications for ease of debugging configurations and for denial of service attacks\&.
.PP
Although a Road Warrior connection must be initiated by the mobile side, the other side can and will rekey using the temporary connection it has created\&. If the Road Warrior wishes to be able to disconnect, it is probably wise to set
\fB\-\-keyingtries\fR
to 1 in the connection on the non\-mobile side to prevent it trying to rekey the connection\&. Unfortunately, there is no mechanism to unroute the connection automatically\&.
.SS "Debugging"
.PP
\fBpluto\fR
accepts several optional arguments, useful mostly for debugging\&. Except for
\fB\-\-interface\fR, each should appear at most once\&.
.PP
\fB\-\-interface\fR \fIinterfacename\fR
.RS 4
specifies that the named real public network interface should be considered\&. The interface name specified should not be
\fBipsec\fR\fIN\fR\&. If the option doesn\*(Aqt appear, all interfaces are considered\&. To specify several interfaces, use the option once for each\&. One use of this option is to specify which interface should be used when two or more share the same IP address\&.
.RE
.PP
\fB\-\-ikeport\fR \fIport\-number\fR
.RS 4
changes the UDP port that
\fBpluto\fR
will use (default, specified by IANA: 500)
.RE
.PP
\fB\-\-ctlbase\fR \fIpath\fR
.RS 4
basename for control files\&.
\fIpath\fR\&.ctl is the socket through which
\fBwhack\fR
communicates with
\fBpluto\fR\&.
\fIpath\fR\&.pid is the lockfile to prevent multiple
\fBpluto\fR
instances\&. The default is
/var/run/pluto/pluto)\&.
.RE
.PP
\fB\-\-secretsfile\fR \fIfile\fR
.RS 4
specifies the file for authentication secrets (default:
/etc/ipsec\&.secrets)\&. This name is subject to \(lqglobbing\(rq as in
\fBsh\fR(1), so every file with a matching name is processed\&. Quoting is generally needed to prevent the shell from doing the globbing\&.
.RE
.PP
\fB\-\-adns\fR \fIpath to adns\fR
.RS 4
specifies where to find
\fBpluto\fR\*(Aqs helper program for asynchronous DNS lookup\&.
\fBpluto\fR
can be built to use
\fB_pluto_adns\fR\&. By default,
\fBpluto\fR
will look for the program in
\fB$IPSEC_DIR\fR
(if that environment variable is defined) or, failing that, in the same directory as
\fBpluto\fR\&.
.RE
.PP
\fB\-\-nofork\fR
.RS 4
disable \(lqdaemon fork\(rq (default is to fork)\&. In addition, after the lock file and control socket are created, print the line \(lqPluto initialized\(rq to standard out\&.
.RE
.PP
\fB\-\-uniqueids\fR
.RS 4
if this option has been selected, whenever a new ISAKMP SA is established, any connection with the same Peer ID but a different Peer IP address is unoriented (causing all its SAs to be deleted)\&. This helps clean up dangling SAs when a connection is lost and then regained at another IP address\&.
.RE
.PP
\fB\-\-force_busy\fR
.RS 4
if this option has been selected, pluto will be forced to be "busy"\&. In this state, which happens when there is a Denial of Service attack, will force pluto to use cookies before accepting new incoming IKE packets\&. Cookies are send and required in ikev1 Aggressive Mode and in ikev2\&. This option is mostly used for testing purposes, but can be selected by paranoid administrators as well\&.
.RE
.PP
\fB\-\-stderrlog\fR
.RS 4
log goes to standard out {default is to use
\fBsyslogd\fR(8))
.RE
.PP
For example
.PP
pluto \-\-secretsfile\ \&ipsec\&.secrets \-\-ctlbase\ \&pluto\&.base \-\-ikeport\ \&8500 \-\-nofork \-\-use\-nostack \-\-stderrlog
.RS 4
.RE
.PP
lets one test
\fBpluto\fR
without using the superuser account\&.
.PP
\fBpluto\fR
is willing to produce a prodigious amount of debugging information\&. To do so, it must be compiled with \-DDEBUG\&. There are several classes of debugging output, and
\fBpluto\fR
may be directed to produce a selection of them\&. All lines of debugging output are prefixed with \(lq|\ \&\(rq to distinguish them from error messages\&.
.PP
When
\fBpluto\fR
is invoked, it may be given arguments to specify which classes to output\&. The current options are:
.PP
\fB\-\-debug\-none\fR
.RS 4
disable all debugging
.RE
.PP
\fB\-\-debug\-all\fR
.RS 4
enable all debugging
.RE
.PP
\fB\-\-debug\-raw\fR
.RS 4
show the raw bytes of messages
.RE
.PP
\fB\-\-debug\-crypt\fR
.RS 4
show the encryption and decryption of messages
.RE
.PP
\fB\-\-debug\-parsing\fR
.RS 4
show the structure of input messages
.RE
.PP
\fB\-\-debug\-emitting\fR
.RS 4
show the structure of output messages
.RE
.PP
\fB\-\-debug\-control\fR
.RS 4
show
\fBpluto\fR\*(Aqs decision making
.RE
.PP
\fB\-\-debug\-controlmore\fR
.RS 4
show even more detailed
\fBpluto\fR
decision making
.RE
.PP
\fB\-\-debug\-lifecycle\fR
.RS 4
[this option is temporary] log more detail of lifecycle of SAs
.RE
.PP
\fB\-\-debug\-klips\fR
.RS 4
show
\fBpluto\fR\*(Aqs interaction with
\fBKLIPS\fR
.RE
.PP
\fB\-\-debug\-pfkey\fR
.RS 4
show
\fBpluto\fR\*(Aqs
\fBPFKEY\fRinterface communication
.RE
.PP
\fB\-\-debug\-dns\fR
.RS 4
show
\fBpluto\fR\*(Aqs interaction with
\fBDNS\fR
for KEY and TXT records
.RE
.PP
\fB\-\-debug\-dpd\fR
.RS 4
show
\fBpluto\fR\*(Aqs
\fBDead Peer Detection\fR
handling
.RE
.PP
\fB\-\-debug\-natt\fR
.RS 4
show
\fBpluto\fR\*(Aqs
\fBNAT Traversal\fR
handling
.RE
.PP
\fB\-\-debug\-oppo\fR
.RS 4
show why
\fBpluto\fR
didn\*(Aqt find a suitable DNS TXT record to authorize opportunistic initiation
.RE
.PP
\fB\-\-debug\-oppoinfo\fR
.RS 4
log when connections are initiated due to acquires from the kernel\&. This is often useful to know, but can be extremely chatty on a busy system\&.
.RE
.PP
\fB\-\-debug\-whackwatch\fR
.RS 4
if set, causes pluto not to release the whack \-\-initiate channel until the SA is completely up\&. This will cause the requestor to possibly wait forever while pluto unsuccessfully negotiates\&. Used often in test cases\&.
.RE
.PP
\fB\-\-debug\-private\fR
.RS 4
allow debugging output with private keys\&.
.RE
.PP
The debug form of the
\fBwhack\fR
command will change the selection in a running
\fBpluto\fR\&. If a connection name is specified, the flags are added whenever
\fBpluto\fR
has identified that it is dealing with that connection\&. Unfortunately, this is often part way into the operation being observed\&.
.PP
For example, to start a
\fBpluto\fR
with a display of the structure of input and output:
.PP
pluto \-\-debug\-emitting \-\-debug\-parsing
.PP
To later change this
\fBpluto\fR
to only display raw bytes:
.PP
whack \-\-debug\-raw
.PP
For testing, SSH\*(Aqs IKE test page is quite useful:
.PP
\fI\m[blue]\fBhttp://isakmp\-test\&.ssh\&.fi/\fR\m[]\fR
.PP
Hint: ISAKMP SAs are often kept alive by IKEs even after the IPsec SA is established\&. This allows future IPsec SA\*(Aqs to be negotiated directly\&. If one of the IKEs is restarted, the other may try to use the ISAKMP SA but the new IKE won\*(Aqt know about it\&. This can lead to much confusion\&.
\fBpluto\fR
is not yet smart enough to get out of such a mess\&.
.SS "Pluto\*(Aqs Behaviour When Things Go Wrong"
.PP
When
\fBpluto\fR
doesn\*(Aqt understand or accept a message, it just ignores the message\&. It is not yet capable of communicating the problem to the other IKE daemon (in the future it might use Notifications to accomplish this in many cases)\&. It does log a diagnostic\&.
.PP
When
\fBpluto\fR
gets no response from a message, it resends the same message (a message will be sent at most three times)\&. This is appropriate: UDP is unreliable\&.
.PP
When pluto gets a message that it has already seen, there are many cases when it notices and discards it\&. This too is appropriate for UDP\&.
.PP
Combine these three rules, and you can explain many apparently mysterious behaviours\&. In a
\fBpluto\fR
log, retrying isn\*(Aqt usually the interesting event\&. The critical thing is either earlier (\fBpluto\fR
got a message which it didn\*(Aqt like and so ignored, so it was still awaiting an acceptable message and got impatient) or on the other system (\fBpluto\fR
didn\*(Aqt send a reply because it wasn\*(Aqt happy with the previous message)\&.
.SS "Notes"
.PP
If
\fBpluto\fR
is compiled without \-DKLIPS, it negotiates Security Associations but never ask the kernel to put them in place and never makes routing changes\&. This allows
\fBpluto\fR
to be tested on systems without
\fBKLIPS\fR, but makes it rather useless\&.
.PP
Each IPsec SA is assigned an SPI, a 32\-bit number used to refer to the SA\&. The IKE protocol lets the destination of the SA choose the SPI\&. The range 0 to 0xFF is reserved for IANA\&.
\fBPluto\fR
also avoids choosing an SPI in the range 0x100 to 0xFFF, leaving these SPIs free for manual keying\&. Remember that the peer, if not
\fBpluto\fR, may well chose SPIs in this range\&.
.SS "Policies"
.PP
This catalogue of policies may be of use when trying to configure
\fBPluto\fR
and another IKE implementation to interoperate\&.
.PP
In Phase 1, only Main Mode is supported\&. We are not sure that Aggressive Mode is secure\&. For one thing, it does not support identity protection\&. It may allow more severe Denial Of Service attacks\&.
.PP
No Informational Exchanges are supported\&. These are optional and since their delivery is not assured, they must not matter\&. It is the case that some IKE implementations won\*(Aqt interoperate without Informational Exchanges, but we feel they are broken\&.
.PP
No Informational Payloads are supported\&. These are optional, but useful\&. It is of concern that these payloads are not authenticated in Phase 1, nor in those Phase 2 messages authenticated with HASH(3)\&.
.PP
\(bu
.RS 4
Diffie Hellman Groups MODP 1024 and MODP 1536 (2 and 5) are supported\&. Group MODP768 (1) is not supported because it is too weak\&.
.RE
.PP
\(bu
.RS 4
Host authetication can be done by RSA Signatures or Pre\-Shared Secrets\&.
.RE
.PP
\(bu
.RS 4
3DES CBC (Cypher Block Chaining mode) is the only encryption supported, both for ISAKMP SAs and IPSEC SAs\&.
.RE
.PP
\(bu
.RS 4
MD5 and SHA1 hashing are supported for packet authentication in both kinds of SAs\&.
.RE
.PP
\(bu
.RS 4
The ESP, AH, or AH plus ESP are supported\&. If, and only if, AH and ESP are combined, the ESP need not have its own authentication component\&. The selection is controlled by the \-\-encrypt and \-\-authenticate flags\&.
.RE
.PP
\(bu
.RS 4
Each of these may be combined with IPCOMP Deflate compression, but only if the potential connection specifies compression and only if KLIPS is configured with IPCOMP support\&.
.RE
.PP
\(bu
.RS 4
The IPSEC SAs may be tunnel or transport mode, where appropriate\&. The \-\-tunnel flag controls this when
\fBpluto\fR
is initiating\&.
.RE
.PP
\(bu
.RS 4
When responding to an ISAKMP SA proposal, the maximum acceptable lifetime is eight hours\&. The default is one hour\&. There is no minimum\&. The \-\-ikelifetime flag controls this when
\fBpluto\fR
is initiating\&.
.RE
.PP
\(bu
.RS 4
When responding to an IPSEC SA proposal, the maximum acceptable lifetime is one day\&. The default is eight hours\&. There is no minimum\&. The \-\-ipseclifetime flag controls this when
\fBpluto\fR
is initiating\&.
.RE
.PP
\(bu
.RS 4
PFS is acceptable, and will be proposed if the \-\-pfs flag was specified\&. The DH group proposed will be the same as negotiated for Phase 1\&.
.RE
.SH "SIGNALS"
.PP
\fBPluto\fR
responds to
\fBSIGHUP\fR
by issuing a suggestion that ``\fBwhack\fR
\-\-listen\*(Aq\*(Aq might have been intended\&.
.PP
\fBPluto\fR
exits when it recieves
\fBSIGTERM\fR\&.
.SH "EXIT STATUS"
.PP
\fBpluto\fR
normally forks a daemon process, so the exit status is normally a very preliminary result\&.
.PP
0
.RS 4
means that all is OK so far\&.
.RE
.PP
1
.RS 4
means that something was wrong\&.
.RE
.PP
10
.RS 4
means that the lock file already exists\&.
.RE
.PP
If
\fBwhack\fR
detects a problem, it will return an exit status of 1\&. If it received progress messages from
\fBpluto\fR, it returns as status the value of the numeric prefix from the last such message that was not a message sent to syslog or a comment (but the prefix for success is treated as 0)\&. Otherwise, the exit status is 0\&.
.SH "FILES"
.PP
/var/run/pluto/pluto\&.pid

/var/run/pluto/pluto\&.ctl

/etc/ipsec\&.secrets

/dev/urandom
.SH "ENVIRONMENT"
.PP
\fIIPSEC_LIBDIR\fR

\fIIPSEC_EXECDIR\fR

\fIIPSECmyid\fR

\fIPLUTO_CORE_DIR\fR
.SH "SEE ALSO"
.PP
The rest of the Libreswan distribution, in particular
\fBipsec\fR(8)\&.
.PP
\fBipsec_auto\fR(8)
is designed to make using
\fBpluto\fR
more pleasant\&. Use it!
.PP
\fBipsec.secrets\fR(5)
describes the format of the secrets file\&.
.PP
\fBipsec_atoaddr\fR(3), part of the Libreswan distribution, describes the forms that IP addresses may take\&.
\fBipsec_atosubnet\fR(3), part of the Libreswan distribution, describes the forms that subnet specifications\&.
.PP
For more information on IPsec, the mailing list, and the relevant documents, see:
.PP
\fI\m[blue]\fBhttp://www\&.ietf\&.cnri\&.reston\&.va\&.us/html\&.charters/ipsec\-charter\&.html\fR\m[]\fR
.PP
At the time of writing, the most relevant IETF RFCs are:
.PP
RFC2409 The Internet Key Exchange (IKE)
.PP
RFC2408 Internet Security Association and Key Management Protocol (ISAKMP)
.PP
RFC2407 The Internet IP Security Domain of Interpretation for ISAKMP
.PP
The Libreswan web site <htp://www\&.libreswan\&.org> and the mailing lists described there\&.
.SH "HISTORY"
.PP
This code is released under the GPL terms\&. See the accompanying files COPYING and CREDITS for more details\&. The GPL does NOT apply to those pieces of code written by others which are included in this distribution, except as noted by the individual authors\&.
.PP
This software was originally written for the FreeS/WAN project <\m[blue]\fBhttp://www\&.freeswan\&.org\fR\m[]>, founded by John Gilmore and managed by Hugh Daniel\&. It was written by Angelos D\&. Keromytis (angelos@dsl\&.cis\&.upenn\&.edu), in May/June 1997, in Athens, Greece\&. Thanks go to John Ioannidis for his help\&.
.PP
It is currently maintained and extended by Xelerance Corporation, in Canada under the Libreswan name\&. See CHANGES for details\&.
.PP
FreeS/WAN was developed/maintained from 2000\-2004 by D\&. Hugh Redelmeier (hugh@mimosa\&.com), in Canada\&. The regulations of Greece and Canada allow the code to be freely redistributable\&.
.PP
Kai Martius (admin@imib\&.med\&.tu\-dresden\&.de) contributed the initial version of the code supporting PFS\&.
.PP
Richard Guy Briggs <rgb@conscoop\&.ottawa\&.on\&.ca> and Peter Onion <ponion@srd\&.bt\&.co\&.uk> added the PFKEY2 support\&.
.PP
We gratefully acknowledge that we use parts of Eric Young\*(Aqs
\fIlibdes\fR
package; see
\fI\&.\&./libdes/COPYRIGHT\fR\&.
.SH "BUGS"
.PP
\fBpluto\fR
is a work\-in\-progress\&. It currently has many limitations\&. For example, it ignores notification messages that it receives, and it generates only Delete Notifications and those only for IPSEC SAs\&.
.PP
\fBpluto\fR
does not support the Commit Flag\&. The Commit Flag is a bad feature of the IKE protocol\&. It isn\*(Aqt protected \-\- neither encrypted nor authenticated\&. A man in the middle could turn it on, leading to DoS\&. We just ignore it, with a warning\&. This should let us interoperate with implementations that insist on it, with minor damage\&.
.PP
\fBpluto\fR
does not check that the SA returned by the Responder is actually one that was proposed\&. It only checks that the SA is acceptable\&. The difference is not large, but can show up in attributes such as SA lifetime\&.
.PP
There is no good way for a connection to be automatically terminated\&. This is a problem for Road Warrior and Opportunistic connections\&. The
\fB\-\-dontrekey\fR
option does prevent the SAs from being rekeyed on expiry\&. Additonally, if a Road Warrior connection has a client subnet with a fixed IP address, a negotiation with that subnet will cause any other connection instantiations with that same subnet to be unoriented (deleted, in effect)\&. See also the \-\-uniqueids option for an extension of this\&.
.PP
When
\fBpluto\fR
sends a message to a peer that has disappeared,
\fBpluto\fR
receives incomplete information from the kernel, so it logs the unsatisfactory message \(lqsome IKE message we sent has been rejected with ECONNREFUSED (kernel supplied no details)\(rq\&. John Denker suggests that this command is useful for tracking down the source of these problems:
tcpdump \-i eth0 icmp[0] != 8 and icmp[0] != 0
Substitute your public interface for eth0 if it is different\&.
.PP
The word \(lqauthenticate\(rq is used for two different features\&. We must authenticate each IKE peer to the other\&. This is an important task of Phase 1\&. Each packet must be authenticated, both in IKE and in IPsec, and the method for IPsec is negotiated as an AH SA or part of an ESP SA\&. Unfortunately, the protocol has no mechanism for authenticating the Phase 2 identities\&.
.PP
Bugs should be reported to the <users@lists\&.libreswan\&.org> mailing list\&.
.SH "AUTHOR"
.PP
\fBPaul Wouters\fR
.RS 4
placeholder to suppress warning
.RE
